home *** CD-ROM | disk | FTP | other *** search
/ Enter 2010 January / ENTER_2010_01.iso / Programy / Gry / Base_Invaders_ / BaseInvadersSetup1.3.exe / {app} / Scripts / Campaign2Startup.lua < prev    next >
Encoding:
Text File  |  2007-01-25  |  8.2 KB  |  296 lines

  1.  
  2. function KamikazeCinematic()
  3.     local tower = G.GetCogName("Tower");
  4.     local towerPos = tower.GetPosition();
  5.     Camera.CinemaLookAt( tower );
  6.  
  7.     -- Have them behind some walls
  8.     TrapPlace( "wall", Vector3(116,0,136), Vector3(1,0,0));
  9.     TrapPlace( "wall", Vector3(116,0,140), Vector3(1,0,0));
  10.     TrapPlace( "wall", Vector3(120,0,140), Vector3(1,0,0));
  11.     TrapPlace( "wall", Vector3(124,0,140), Vector3(1,0,0));
  12.     TrapPlace( "wall", Vector3(128,0,140), Vector3(1,0,0));
  13.     TrapPlace( "wall", Vector3(132,0,140), Vector3(1,0,0));
  14.     TrapPlace( "wall", Vector3(136,0,140), Vector3(1,0,0));
  15.     TrapPlace( "wall", Vector3(136,0,136), Vector3(1,0,0));
  16.     TrapPlace( "wall", Vector3(136,0,132), Vector3(1,0,0));
  17.     TrapPlace( "wall", Vector3(136,0,128), Vector3(1,0,0));
  18.  
  19.     -- Two invaders talking:
  20.     local CinemaInvader  = G.CreateAt( "Basic", Vector3( 122, 0, 134 ) );
  21.     local CinemaInvader2  = G.CreateAt( "Basic", Vector3( 132, 0, 134 ) );
  22.     
  23.     CinemaInvader.TurnOffAI();
  24.     CinemaInvader2.TurnOffAI();
  25.     
  26.     CinemaInvader.SetDirection( Vector3(1,0,0) )
  27.     CinemaInvader2.SetDirection( Vector3(-1,0,0) )
  28.  
  29.  
  30.     -- Show off level again    
  31.     TraitorTalk("Welcome Back!")
  32.     Camera.CinemaMove( towerPos + Vector3(-40,65,-40), towerPos, 3 );
  33.     GameWait(3)    
  34.     
  35.     Camera.CinemaRotate( 3.14 * 2.0 / 12.0 )
  36.         
  37.     TraitorTalk("It may look like your base is in shambles, but I did this for a reason.")
  38.     GameWait(6)    
  39.     TraitorTalk("If I know my brothers, they'll be pretty angry that we're still alive.");
  40.     GameWait(6)
  41.  
  42.     camPos = Vector3(130,40,170)
  43.     Camera.CinemaMove( camPos, Vector3(126,0,130), 4 );
  44.     Camera.CinemaRotate(0)    
  45.     Camera.EndCinemaLookAt( );
  46.     TraitorTalk( "Shh! I hear some invaders around here..." );
  47.     GameWait( 5 );
  48.  
  49.     invPos = CinemaInvader.GetPosition()
  50.     invPos[2] = invPos[2] - 8
  51.     invPos2 = CinemaInvader2.GetPosition()
  52.     invPos2[2] = invPos2[2] - 8
  53.     
  54.     --CinemaInvader.SetDirection( )
  55.     G.SayPhraseScript( "Great, \n more walls." , CinemaInvader2 );
  56.     GameWait( 2 );
  57.     G.EndCurrentPhrase( CinemaInvader2 )
  58.     
  59.     Camera.CinemaMove( camPos, invPos, 0.5 );
  60.     CinemaInvader.Hop( 20 )
  61.     G.SayPhraseScript( "Hey did you\n hear?" , CinemaInvader );
  62.     GameWait( 2 );
  63.     G.EndCurrentPhrase( CinemaInvader )
  64.     
  65.     Camera.CinemaMove( camPos, invPos2, 0.5 );
  66.     CinemaInvader2.Hop( 20 )
  67.     G.SayPhraseScript( "Hear what?" , CinemaInvader2 );
  68.     GameWait( 2 );
  69.     G.EndCurrentPhrase( CinemaInvader2 )
  70.     
  71.     Camera.CinemaMove( camPos, invPos, 0.5 );
  72.     CinemaInvader.Hop( 20 )
  73.     G.SayPhraseScript( "They're sending \n in demolition \n experts." , CinemaInvader );
  74.     GameWait( 2 );
  75.     G.EndCurrentPhrase( CinemaInvader )
  76.     
  77.     Camera.CinemaMove( camPos, invPos2, 0.5 );
  78.     
  79.     G.SayPhraseScript( "Experts?!? \n Oh no ..." , CinemaInvader2 );
  80.     GameWait( 2 );
  81.     
  82.     local CinemaInvader3  = G.CreateAt( "Kamikaze", Vector3( 90, 0, 110 ) );
  83.     G.SayPhraseScript( "AHHHH!!" , CinemaInvader );
  84.     G.SayPhraseScript( "AHHHH!!" , CinemaInvader2 );
  85.     G.SayPhraseScript( "BANZAAAIII!" , CinemaInvader3 );
  86.     
  87.     GameWait( 1 );
  88.     local CinemaInvader4  = G.CreateAt( "Kamikaze", Vector3( 90, 0, 110 ) );
  89.     
  90.     -- Kaboom!
  91.     TraitorTalk( "Kamikazes! They're highly unstable and will blow on anything they hit!" );
  92.     GameWait( 5 );
  93.     
  94.     G.KillAllInvaders();
  95. end
  96.  
  97. function BomberCinematic()
  98.  
  99.     -- Bomber appears, depressed, 
  100.     camPos = Vector3(130,40,170)
  101.     Camera.CinemaMove( camPos, Vector3(126,0,126), 4 );
  102.     TraitorTalk( "A new invader's coming in!" );
  103.  
  104.     local CinemaInvader  = G.CreateAt( "Bomber", Vector3( 125, 0, 130 ) );
  105.     CinemaInvader.TurnOffAI();
  106.     GameWait(4)
  107.     G.SayPhraseScript( "Everyone \n avoids me..." , CinemaInvader );
  108.  
  109.     TraitorTalk("Bombers?! ARGH! Those invaders have huge explosions!")
  110.     GameWait(3)
  111.     
  112.     G.SayPhraseScript( " *Sigh* \n Guess I'll \n Attack now." , CinemaInvader );
  113.     GameWait(3)
  114.     
  115.     TraitorTalk("They eventually explode on their own, but they'll take out anything that's nearby.")
  116.  
  117.     G.SayPhraseScript( "Goodbye,\n Cruel World." , CinemaInvader );
  118.     GameWait(2)
  119.     
  120.     CinemaInvader.ChangeStateScript( 5 );
  121.     GameWait(5)
  122.     
  123.     
  124. end
  125.  
  126.  
  127. --Common Level Start Code
  128. function LevelStartup()
  129.  
  130.     G.Create( "MenuData/HudCog.xml" );
  131.     G.Create( "Data/GameCamera.xml" );
  132.     G.Create( "Data/CursorCog.xml" );
  133.  
  134.     MainLevel = G.Create( "Data/Levels/Campaign2.xml" );
  135.     MainLevel.CreateLevel();
  136.  
  137.     G.SetInvSpeed( 20 );
  138.     HUD.EnterLevel();
  139.     G.SetGameState( InLevel );
  140.     G.EarnPoints( 100 );
  141.     G.SetMaxKills(0);
  142.     
  143.     G.SetLightTime( 5 );
  144.     G.PostP( "None" );
  145.  
  146.     -- gameStartTime = 10000000;
  147.  
  148.     HUD.Message( "VictoryCondition" , "SetText", "Survive the Explosive Waves!"  );
  149.     HUD.Message( "LossCondition" , "SetText", "If the Tower falls you lose." );
  150.     
  151.     TraitorCanBeHidden = true    
  152.     --TraitorTalk(" ");
  153. end
  154.  
  155. LevelStartup()
  156.  
  157. function LevelIntro()
  158.     
  159.     local tempPos = Tower.GetPosition()
  160.     Camera.LookAtPosition( tempPos )
  161.  
  162.     -- There is no intro for this level:
  163.     gameStartTime = GameTime;
  164.  
  165.     ColorTextPopup( "Level 2: Krazy Kamikazes", Color(1,1,1,1) )
  166.  
  167.     G.DisableTrapAll()
  168.  
  169.     DisableTraitor()
  170.     GameWait(1.5)
  171.     
  172.     StartCinematic()
  173.         KamikazeCinematic()
  174.     EndCinematic()
  175.     
  176.  
  177.     G.EnableTrap("wall");
  178.     G.EnableTrap("fan");
  179.     G.EnableTrap("hammer");
  180. end
  181.  
  182. function LevelSequence()
  183.     
  184.     -- 1st Have a tower and some walls and let the basic guys attack.
  185.     Traitor.SetGuiPosition( "TraitorWindow"  , Vector3(0.6, -0.5, 1) );
  186.     
  187.     -- Start Spawning the guys
  188.     ExplosiveWave = createSpawnStruct()
  189.     
  190.     ExplosiveWave.Prob.Kamikaze    = 1.0;
  191.     
  192.     ExplosiveWave.SpawnSpeed    = 1;
  193.     ExplosiveWave.MaxSpawn        = 15;
  194.     ExplosiveWave.TotalSpawn    = 21;    -- + 4 for cinematic
  195.     ExplosiveWave.GroupPercent    = 0.0;
  196.     ExplosiveWave.GroupSize        = 3;
  197.     ExplosiveWave.WhereToSpawn    = CircleAroundTower
  198.  
  199.     InvaderTextPopup( "Kamikaze" );
  200.     AddWave( "StartAttack", ExplosiveWave );
  201.     G.SetMaxKills(25);    
  202.     
  203.     TraitorTalk("They'll blow up if they hit anything. Better throw them first!")
  204.     
  205.     InvadersKilledWait(22)
  206.     
  207.     TraitorTalk( "Just a few more Kamikazes!" )
  208.     InvadersKilledWait( 25 )
  209.     
  210.     StopWave( "StartAttack" );    
  211.     GameWait(3)
  212.     TraitorTalk( "Wow, we took a beating. We can't rely on hammers to destroy these guys.");
  213.     GameWait(7)
  214.     TraitorTalk("I know!  Here are the blueprints for a Spring Trap!" )
  215.     
  216.     TrapTextPopup("Springs")    
  217.     G.EarnPoints( 50 )
  218.     G.EnableTrap("spring");
  219.     G.EarnPoints( 25 )
  220.  
  221.     GameWait(4)
  222.     TraitorTalk( "They throw invaders high up into the air!" )
  223.     GameWait(4)
  224.     TraitorTalk( "Go ahead and place some down.  You'll thank me later.");
  225.     GameWaitOrMoney(25)
  226.     
  227.     ExplosiveWave.Prob.Basic    = 0.4;    -- Spawn some basics too
  228.     ExplosiveWave.SpawnSpeed    = 0.5;
  229.     ExplosiveWave.TotalSpawn    = 25;
  230.     
  231.     AddWave( "MainAttack", ExplosiveWave );
  232.     G.SetMaxKills(50);
  233.     
  234.     TraitorTalk("Oh no, look out! More Kamikazes!")
  235.     GameWait(6)
  236.     TraitorTalk("There's some brave Basic invaders too!")
  237.     InvadersKilledWait(45)    
  238.     
  239.     TraitorTalk( "Almost There!" )
  240.     InvadersKilledWait( 50 ) --WaitForClearEnemies( )
  241.     StopWave( "MainAttack" );    
  242.     GameWait(3)
  243.     TraitorTalk( "Wow, good job.  But don't quit yet, I have a feeling it's not over." )
  244.     GameWait(9)
  245.     
  246.     TraitorTalk( "Remember that you can use fans to blow the Invaders into the spring traps!" )
  247.     GameWait(7)
  248.     TraitorTalk("You better rebuild, I think I hear more coming.");
  249.     G.EarnPoints( 50 )
  250.     GameWaitOrMoney(25)
  251.     
  252.     -- Bomber Intro
  253.  
  254.     StartCinematic()
  255.         BomberCinematic()
  256.     EndCinematic()
  257.     
  258.     TraitorTalk( "Watch out! Those Bombers are too big to be blown around by fans!" )    
  259.     
  260.     ExplosiveWave.Prob.Bomber    = 3.0;
  261.     ExplosiveWave.TotalSpawn    = 29;
  262.     ExplosiveWave.GroupPercent    = 0.3;
  263.     ExplosiveWave.WhereToSpawn    = SmallCircleAroundTower
  264.  
  265.     InvaderTextPopup( "Bomber" );
  266.  
  267.     AddWave( "FinalAttack", ExplosiveWave );
  268.     G.SetMaxKills(80);
  269.             
  270.     InvadersKilledWait(65)
  271.     
  272.     TraitorTalk( "Hold out a bit longer!" )
  273.     InvadersKilledWait( 80 ) --WaitForClearEnemies( )
  274.     StopWave( "FinalAttack" );
  275.     
  276.     TraitorTalk( "Hey, we're alive! Woohoo!" )
  277.     GameWait(4)
  278.  
  279.     G.SetGameState( Victory );
  280.  
  281.     TraitorTalk( "I bet we'll be seeing more of those explosive invaders in the future." )
  282.     GameWait(6)
  283.  
  284.  
  285. --    TraitorTalk( "I mean, I never had a doubt...  ");
  286. --    GameWait(4)
  287. --    TraitorTalk( "Remember that you can still grab and throw invaders, but those traps sure do help!" )
  288. --    GameWait(6)
  289.     
  290. --    G.SetGameState( Victory );    
  291. end
  292.  
  293. levelRoutine = coroutine.create(LevelIntro);
  294.  
  295. GMain["LevelUpdate"] = LevelUpdate;
  296.